package com.xxx.reggie.mapper;

import com.xxx.reggie.entity.Employee;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface EmployeeMapper {

    //根据账号名查找员工信息
    @Select("select * from employee where username=#{username}")
    Employee login(Employee employee);

    @Insert("INSERT INTO employee VALUE(NULL,#{name},#{username},#{password},\n" +
            "#{phone},#{sex},#{idNumber},#{status},#{createTime},#{updateTime},\n" +
            "#{createUser},#{updateUser})")
    void save(Employee employee);


    //查询指定页列表数据,根据条件筛选查询
    List<Employee> findByName(@Param("name") String name);


    //根据id更改状态
    void update(Employee employee);


    //根据id查询员工对象
    @Select("select * from employee where id=#{id}")
    Employee findById(long id);

}
